package com.bilibili.server.controller;

import com.bilibili.model.vo.UserInfoVo;
import com.bilibili.server.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author HuangRongFu
 * 2021/11/17 星期三8:54 上午
 */

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserInfoService userInfoService;


    /**
     * 完善个人信息
     *@params: userInfoVo
     *@params: token
     *@Return: ResponseEntity
     */
    @PostMapping("/loginReginfo")
    public ResponseEntity loginReginfo(@RequestBody UserInfoVo userInfoVo) {

        userInfoService.loginReginfo(userInfoVo);
        return ResponseEntity.ok(null);
    }

    @PostMapping("/loginReginfo/head")
    public ResponseEntity uploadAvatar(MultipartFile headPhoto){

        userInfoService.uploadAvatar(headPhoto);
        return ResponseEntity.ok(null);
    }
}
